//
//  MenuHeaderView.m
//  TCProject
//
//  Created by admin on 16/1/18.
//  Copyright © 2016年 wise-wing. All rights reserved.
//

#import "MenuHeaderView.h"

@implementation MenuHeaderView

- (instancetype)initWithFrame:(CGRect)frame{
    if (self = [super initWithFrame:frame]) {
        self.backgroundColor = kGlobalColor;
        UIImageView *imageView = [[UIImageView alloc] init];
        imageView.backgroundColor = [UIColor lightGrayColor];
        [self addSubview:imageView];
        self.iconView = imageView;
        imageView.layer.cornerRadius = 25.f;
        imageView.layer.masksToBounds = YES;
        
        UILabel *uidLabel = [[UILabel alloc] init];
        uidLabel.font = [UIFont systemFontOfSize:11.f];
        uidLabel.textColor = [UIColor whiteColor];
        [self addSubview:uidLabel];
        self.uidLabel = uidLabel;
        
        UILabel *phoneLabel = [[UILabel alloc] init];
        phoneLabel.font = [UIFont systemFontOfSize:11.f];
        phoneLabel.textColor = [UIColor whiteColor];
        [self addSubview:phoneLabel];
        self.phoneLabel = phoneLabel;
        
        [imageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.mas_equalTo(self).offset(15.f);
            make.centerY.mas_equalTo(self).offset(10.f);
            make.width.height.mas_equalTo(50.f);
        }];
        
        [uidLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.mas_equalTo(imageView).offset(3.f);
            make.left.mas_equalTo(imageView.mas_right).offset(10.f);
        }];
        
        [phoneLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.bottom.mas_equalTo(imageView).offset(-3.f);
            make.left.mas_equalTo(imageView.mas_right).offset(10.f);
        }];
        
        UIImage *image = [UIImage imageNamed:@"arrow"];
        UIImageView *arrow = [[UIImageView alloc] initWithImage:image];
        [self addSubview:arrow];
        [arrow mas_makeConstraints:^(MASConstraintMaker *make) {
            make.size.mas_equalTo(image.size);
            make.centerY.mas_equalTo(self).offset(10.f);
            make.right.mas_equalTo(self).offset(-15.f);
        }];
        
    }
    return self;
}

@end
